+2007-12-29 Øyvind Kolås <pippin@gimp.org>
+
+ * babl/babl.h:
+ * babl/babl-classes.h:
+ * babl/babl-fish-path.c:
+ * babl/babl-fish-reference.c:
+ * babl/babl-fish.c:
+ * babl/babl-internal.[ch]: Const'ified code with Babl*'s refering to
+ formats.
+
2007-02-17 Øyvind Kolås <pippin@gimp.org>
* configure.ac: post release version increment to 0.0.17
typedef struct
BablConversion {
BablInstance instance;
- Babl *source;
- Babl *destination;
+ const Babl *source;
+ const Babl *destination;
long cost;
double error;
union
typedef struct
{
BablInstance instance;
- Babl *source;
- Babl *destination;
+ const Babl *source;
+ const Babl *destination;
double error; /* the amount of noise introduced by the fish */
#include "babl-internal.h"
static double
-chain_error (Babl *fmt_source,
- Babl *fmt_destination,
+chain_error (const Babl *fmt_source,
+ const Babl *fmt_destination,
BablConversion **chain,
int conversions);
typedef struct BablChainContext
{
- Babl *from;
- Babl *to;
+ const Babl *from;
+ const Babl *to;
double *best_cost;
double *best_loss;
void *userdata);
static int
-get_conversion_chain (Babl *from,
- Babl *to,
+get_conversion_chain (const Babl *from,
+ const Babl *to,
double *best_cost,
double *best_loss,
double *best_error,
static char buf[1024];
static char *
-create_name (Babl *source,
- Babl *destination,
- int is_reference)
+create_name (const Babl *source,
+ const Babl *destination,
+ int is_reference)
{
/* fish names are intentionally kept short */
snprintf (buf, 1024, "%s %p %p", "",
}
Babl *
-babl_fish_path (Babl *source,
- Babl *destination)
+babl_fish_path (const Babl *source,
+ const Babl *destination)
{
Babl *babl = NULL;
char *name = create_name (source, destination, 1);
}
static double
-chain_error (Babl *fmt_source,
- Babl *fmt_destination,
+chain_error (const Babl *fmt_source,
+ const Babl *fmt_destination,
BablConversion **chain,
int conversions)
{
static char buf[1024];
static char *
-create_name (Babl *source,
- Babl *destination,
+create_name (const Babl *source,
+ const Babl *destination,
int is_reference)
{
/* fish names are intentionally kept short */
Babl *
-babl_fish_reference (Babl *source,
- Babl *destination)
+babl_fish_reference (const Babl *source,
+ const Babl *destination)
{
Babl *babl = NULL;
char *name = create_name (source, destination, 1);
}
Babl *
-babl_conversion_find (void *source,
- void *destination)
+babl_conversion_find (const void *source,
+ const void *destination)
{
- void *data = destination;
+ void *data = (void*)destination;
babl_list_each ((void *) BABL (source)->type.from, match_conversion, &data);
- if (data == destination)
+ if (data == (void*)destination) /* didn't change */
return NULL;
return data;
}
}
static inline Babl *
-go_fishing (Babl *source,
- Babl *destination)
+go_fishing (const Babl *source,
+ const Babl *destination)
{
BablDb *db = babl_fish_db ();
int i;
}
Babl *
-babl_fish (void *source,
- void *destination,
+babl_fish (const void *source,
+ const void *destination,
...)
{
- Babl *source_format = NULL;
- Babl *destination_format = NULL;
+ const Babl *source_format = NULL;
+ const Babl *destination_format = NULL;
babl_assert (source);
babl_assert (destination);
const char *
-babl_name (Babl *babl)
+babl_name (const Babl *babl)
{
babl_assert (BABL_IS_BABL (babl));
return babl->instance.name;
#define random rand
#endif
-Babl * babl_conversion_find (void *source,
- void *destination);
+Babl * babl_conversion_find (const void *source,
+ const void *destination);
double babl_conversion_error (BablConversion *conversion);
long babl_conversion_cost (BablConversion *conversion);
long babl_conversion_process (Babl *conversion,
long n);
BablDb * babl_fish_db (void);
-Babl * babl_fish_reference (Babl *source,
- Babl *destination);
+Babl * babl_fish_reference (const Babl *source,
+ const Babl *destination);
Babl * babl_fish_simple (BablConversion *conversion);
void babl_fish_stats (FILE *file);
-Babl * babl_fish_path (Babl *source,
- Babl *destination);
+Babl * babl_fish_path (const Babl *source,
+ const Babl *destination);
long babl_fish_path_process (Babl *babl,
void *source,
* destination_format, source and destination can be
* either strings with the names of the formats or BablFormat objects.
*/
-Babl * babl_fish (void *source_format,
- void *destination_format,
+Babl * babl_fish (const void *source_format,
+ const void *destination_format,
...);
/** Process n pixels from source to destination using babl_fish,
*/
-const char *babl_name (Babl *babl); /* returns the name of a babl object */
+const char *babl_name (const Babl *babl); /* returns the name of a babl object */
void babl_introspect (Babl *babl); /* introspect a given BablObject */
#undef BABL_CLASS